
#include <iostream>
#include <unistd.h>
#include <pthread.h>

void *thread_func(void *arg)
{
    while (1)
    {
        std::cout << "the new thread is running , id = " << std::hex << pthread_self() << std::endl;
        sleep(1);
    }
    return nullptr;
}

int main()
{
    pthread_t thread;
    pthread_create(&thread, nullptr, thread_func, nullptr);
    while (1)
    {
        std::cout << "the main thread is running  , id = " <<  std::hex << pthread_self() <<std::endl;
        sleep(1);
    }
    return 0;
}